package com.xjh.him.controller;

import com.xjh.him.annotation.LoginVerify;
import com.xjh.him.dto.usergroup.UserGroupAddDTO;
import com.xjh.him.service.UserGroupServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xjh.tool.dto.ResultDTO;
import org.xjh.tool.vo.AjaxResultVO;

@RestController
@RequestMapping("/user/group")
public class UserGroupController {

    @Autowired
    private UserGroupServiceImpl userGroupService;


    @LoginVerify
    @RequestMapping("/add")
    public AjaxResultVO addGroup(@RequestBody UserGroupAddDTO addDTO) {
        ResultDTO<Boolean> resultDTO = userGroupService.addGroup(addDTO);
        if (resultDTO.isSuccess()) {
            return AjaxResultVO.getSuccessResult(resultDTO.getResult());
        }
        return AjaxResultVO.getFailureResult(resultDTO.getErrMsg());
    }
}
